package com.syni.mdd.yhd.common.all.config.pay.wxPay;

import lombok.Data;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.context.annotation.DependsOn;
import org.springframework.context.annotation.Profile;

/**
 * <p>IJPay 让支付触手可及，封装了微信支付、支付宝支付、银联支付常用的支付方式以及各种常用的接口。</p>
 *
 * <p>不依赖任何第三方 mvc 框架，仅仅作为工具使用简单快速完成支付模块的开发，可轻松嵌入到任何系统里。 </p>
 *
 * <p>IJPay 交流群: 723992875</p>
 *
 * <p>Node.js 版: https://gitee.com/javen205/TNW</p>
 *
 * <p>微信配置 Bean</p>
 *
 * @author Javen
 */
@Data
@Configuration
@DependsOn("wxPayBeanFactory")
public class MinAppWxPayBean extends WxPayBean{
    private String appId = "wx56ab29f890724cf7";
    private String appSecret = "";
    private String mchId = "1563829591";
    private String partnerKey = "z1SrP68ht18FExkDnuOLy7BsGaUdvyOh";
    private String certPath = "/home/syniapp/mdd_cloud/global_config/apiclient_cert.p12";
    private String certPath_local = "D:/公司开发/公司开发/cert/apiclient_cert.p12";
    private String domain = WxPayBeanFactory.DEV_BACK_URL + "/MDD_API/DSP_API";
    private String domain_pro = "https://w.syni.com/MDD_API/DSP_API";
    private String payNotifyUrl;
    private String refundNotifyUrl;


    @Bean(name = "MIN_APP")
    @Profile({"dev","local","preo"})
    public MinAppWxPayBean getMinAppWxPayBeanByDev(){
        MinAppWxPayBean minAppWxPayBean = new MinAppWxPayBean();
        minAppWxPayBean.setAppId(appId);
        minAppWxPayBean.setMchId(mchId);
        minAppWxPayBean.setPartnerKey(partnerKey);
        minAppWxPayBean.setCertPath(certPath_local);
        minAppWxPayBean.setDomain(domain);
        minAppWxPayBean.setPayNotifyUrl(minAppWxPayBean.getDomain() + "/wxPay/payNotify");
        minAppWxPayBean.setRefundNotifyUrl(minAppWxPayBean.getDomain() + "/wxPay/refundNotify");
        return minAppWxPayBean;
    }

    @Bean(name = "MIN_APP")
    @Profile("pro")
    public MinAppWxPayBean getMinAppWxPayBeanByPro(){
        MinAppWxPayBean minAppWxPayBean = new MinAppWxPayBean();
        minAppWxPayBean.setAppId(appId);
        minAppWxPayBean.setMchId(mchId);
        minAppWxPayBean.setPartnerKey(partnerKey);
        minAppWxPayBean.setCertPath(certPath);
        minAppWxPayBean.setDomain(domain_pro);
        minAppWxPayBean.setPayNotifyUrl(minAppWxPayBean.getDomain() + "/wxPay/payNotify");
        minAppWxPayBean.setRefundNotifyUrl(minAppWxPayBean.getDomain() + "/wxPay/refundNotify");
        return minAppWxPayBean;
    }

}